# e2fsprogs

. ../../func
. ../../build.conf

. /etc/DISTRO_SPECS
[ "${DISTRO_DB_SUBNAME#common}" != "${DISTRO_DB_SUBNAME}" ] && \
	export LDFLAGS=-lrt

VER=1.43.9
URL=https://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/v${VER}
PKG=e2fsprogs
COMP=tar.gz
DESC="ext2/3/4 filesystem utilities"
DEPS=
CAT=BuildingBlock
DESKTOP=e2fsprogs.desktop
BUILD=
CWD=$(pwd)
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
# comment these 2 below if you use a custom package() function
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not

ARCH=$(uname -m)
case $ARCH in # set in build.conf
 *64) 	LIBDIR=$LIBCONF64 
		FLAGS=$CF64;;
 arm*)	LIBDIR=$LIBCONFarm
		FLAGS="-O2" ;;
 i686) 	LIBDIR=$LIBCONF32 
		FLAGS=$CF32;;
	*) 	LIBDIR=$LIBCONF32 
		FLAGS="-O2 -march=$ARCH -mtune=$ARCH";;
esac

# main
retrieve ${PKG}-${VER}.${COMP}
extract ${PKG}-${VER}.${COMP}

#build_configure $PKG $VER $LIBDIR "$FLAGS"
	cd ${PKG}-${VER}
	sed -i 's/64bit,//g' ./misc/mke2fs.conf.in
	CFLAGS="${FLAGS}" \
	CXXFLAGS="${FLAGS}" \
	./configure --prefix=/usr \
				--localstatedir=/var \
				--sysconfdir=/etc \
				--libdir=/usr/${LIBDIR} ${EXTRA_CONFIG_OPTS}

	mkdir -v build
	cd build
	../configure --prefix=/usr       \
				--bindir=/bin           \
				--with-root-prefix=""   \
				--enable-elf-shlibs     \
				--disable-libblkid      \
				--disable-libuuid       \
				--disable-uuidd         \
				--disable-fsck \
				--disable-nls
	[ "$?" -eq 0 ] || exit
	make $MKFLG
	[ "$?" -eq 0 ] || exit
	make DESTDIR=$CWD/${PKG}-install install
cd ../..

package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT
